﻿@model FlyingClub.Models.PlanesDetailsViewModel

@{
    ViewBag.Title = "Détails";
}

<h1>@ViewBag.Title</h1>

<table class="planes-tab">
    <tbody>
        <tr>
            <td>Nom</td>
            <td>Prix/H</td>
            <td>Identifiant</td>
        </tr>
        <tr>
            <td>@Html.DisplayFor(model => model.Plane.Name)</td>
            <td>@Html.DisplayFor(model => model.Plane.HourRate)</td>
            <td>@Html.DisplayFor(model => model.Plane.Number)</td>
        </tr>
    </tbody>
</table>

<div class="link-button">
    <a href="/Planes/Edit/@Model.Plane.ID#admin">Editer</a>
    <a href="/Planes#admin-planes">Retour à la liste</a>
</div>
<div></div>
@{
    int j = 0;
}

@foreach(DateTime Date in Model.CalendarMaxDay)
{
    if (j % 3 == 0)
    {
        @:<div>
    }
    
    <table class="planes-date-tab">
        <tbody>
            <tr><td colspan="7" style="text-align : center;">@Date.Month</td></tr>
            <tr>
                <td>Lun</td>
                <td>Mar</td>
                <td>Mer</td>
                <td>Jeu</td>
                <td>Ven</td>
                <td>Sam</td>
                <td>Dim</td>
            </tr>
    @{
        int Month = DateTime.Now.Month + 1;
        int DayOfWeek = (int)Date.DayOfWeek-1;
        if (DayOfWeek == -1)
        {
            DayOfWeek = 6;
        }
    }
    @for (int i = 0; i < (DateTime.DaysInMonth(Date.Year, Date.Month) + DayOfWeek); i++)
    {
        if (i % 7 == 0)
        {
            @:<tr>
        }


        if (i < DayOfWeek)
        {
            @:<td></td>
        }
        else
        {
            @:<td><a href="/Planes/Calendar/@Model.Plane.ID/@Date.Year/@Date.Month/@(i + 1 - DayOfWeek)" @if(DateTime.Now.Day == (i + 1 - DayOfWeek) && DateTime.Now.Month == Date.Month)
            {
                @:style="background-image : -o-radial-gradient(center center, 50% 50%, rgba(252, 255, 245, 1), rgba(145, 170, 157, 1)); font-weight : bold; color : rgb(0, 0, 0);"
            }>@(i + 1 - DayOfWeek)</a></td>
        }

        if (i % 7 == 6)
        {
            @:</tr>
        }
    }
        </tbody>
    </table>
    if (j % 3 == 2)
    {
        @:</div><div class="break-line"></div>
    }
    j += 1;
}
